home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / DRVS.C < prev    next >
C/C++ Source or Header  |  1993-06-10  |  4KB  |  105 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 06-05-93 (12:36)             Number: 36
  4. From: DAVID GERSIC                 Refer#: NONE
  5.   To: DANIEL LYNES                  Recvd: NO  
  6. Subj: Re: Problem(?)                 Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. /* Quoting Daniel Lynes on 05-31-93  03:42... */
  9.  
  10.  BS>**  Includes drive letters assigned with DOS SUBST command
  11.  BS>**  Networked drives are left as an exercise as I don't have access BS>**  t
  12.  DL> them to check.
  13.  DL> Ok, well the routine that I was attempting to write would allow
  14.  DL> inclusion of Novell networked drives as well.
  15.  
  16. I don't know why Bob didn't post mine, instead...
  17.  
  18. /*
  19. **  DRVS.C - public domain by David Gersic, DeKalb, Il 1993
  20. **
  21. **  Routine checks how many valid disk drives are available on machine,
  22. **  both physical and logical drives.
  23. **
  24. **  Includes drive letters assigned with DOS SUBST command and network
  25. **  drives for Novell Netware (and probably other networks).
  26. **
  27. **  Compiled Under MSC 6 LARGE memory Model
  28. **  Should be compatible with other DOS compilers
  29. **
  30. */
  31.  
  32. #include <stdio.h>
  33. #include <dos.h>
  34. #include <stdlib.h>
  35.  
  36. main()
  37. {
  38.     union REGS in, out;
  39.     int i;
  40.     /* Novell's shell TSRs allow up to 31 drive 'letters' to be created */
  41.     char drives[]={' ','a','b','c','d','e','f','g','h','i','j',
  42.                    'k','l','m','n','o','p','q','r','s','t','u',
  43.                    'v','w','x','y','z','[','\\',']','^','`'};
  44.     in.x.ax=0x4409;
  45.     for(i=1;i<32;i++)
  46.     {
  47.          in.h.bl=(unsigned char)i;
  48.          intdos(&in,&out);
  49.          if(!out.x.cflag)
  50.               printf("drive %c: is %s\n",
  51.               drives[i],out.x.dx & 1<<15 ? "subst" :
  52.               out.x.dx & 1<<12 ? "network" : "local");
  53.     }
  54.     return(0);
  55. }
  56.  
  57.  
  58. ... CALCULUS: the agony and dx/dt
  59. --- FMail 0.92
  60.  * Origin: NIU Connection (815)753-1800  (1:11/70.0)
  61. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  62. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
  63. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  64. ===========================================================================
  65.  BBS: The Abacus * HST/DS * Potterville, MI
  66. Date: 06-07-93 (23:57)             Number: 261
  67. From: DAVID GERSIC                 Refer#: NONE
  68.   To: BOB STOUT                     Recvd: NO  
  69. Subj: DRVS.C                         Conf: (36) C Language
  70. ---------------------------------------------------------------------------
  71. I just noticed a bug in my DRVS.C code. I missed a drive "letter"...
  72. Corrected code here:
  73.  
  74. #include <stdio.h>
  75. #include <dos.h>
  76. #include <stdlib.h>
  77.  
  78. main()
  79. {
  80.     union REGS in, out;
  81.     int i;
  82.     char drives[]={' ','a','b','c','d','e','f','g','h','i','j',
  83.                    'k','l','m','n','o','p','q','r','s','t','u',
  84.                    'v','w','x','y','z','[','\\',']','^','_','`'};
  85.     in.x.ax=0x4409;
  86.     for(i=1;i<32;i++)
  87.     {
  88.          in.h.bl=(unsigned char)i;
  89.          intdos(&in,&out);
  90.          if(!out.x.cflag)
  91.               printf("drive %c: is %s\n",
  92.               drives[i],out.x.dx & 1<<15 ? "subst" :
  93.               out.x.dx & 1<<12 ? "network" : "local");
  94.     }
  95.     return(0);
  96. }
  97.  
  98.  
  99. ... The average, healthy adult gets up at 7:30am feeling terrible.
  100. --- FMail 0.92
  101.  * Origin: NIU Connection (815)753-1800  (1:11/70.0)
  102. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  103. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
  104. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  105.